package
{
	import com.peterelst.draw3D.Draw3D;
	import com.peterelst.draw3D.Plane3D;
	import com.peterelst.draw3D.Point3D;
	
	import flash.display.Sprite;
	import flash.events.Event;

	[SWF(width=800,height=600,backgroundColor=0xffffff)]
	public class Draw3DExample extends Sprite
	{

		public function Draw3DExample()
		{
			drawCubePlanes();
		}
		
		public function drawCubePlanes():void {
			
			this.graphics.clear();
			this.graphics.lineStyle(0, 0x000000, 0);
			
			var pt1:Point3D = new Point3D(100, 100, 0);
			var pt2:Point3D = new Point3D(200, 100, 0);
			var pt3:Point3D = new Point3D(200, 200, 0);
			var pt4:Point3D = new Point3D(100, 200, 0);
			var pt5:Point3D = new Point3D(100, 100, 100);
			var pt6:Point3D = new Point3D(200, 100, 100);
			var pt7:Point3D = new Point3D(200, 200, 100);
			var pt8:Point3D = new Point3D(100, 200, 100);
			var pt9:Point3D = new Point3D(100, 100, 0);
			var pt10:Point3D = new Point3D(100, 100, 100);
			var pt11:Point3D = new Point3D(200, 100, 100);
			var pt12:Point3D = new Point3D(200, 100, 0);
			var pt13:Point3D = new Point3D(100, 200, 0);
			var pt14:Point3D = new Point3D(100, 200, 100);
			var pt15:Point3D = new Point3D(200, 200, 100);
			var pt16:Point3D = new Point3D(200, 200, 0);
			var pt17:Point3D = new Point3D(100, 100, 0);
			var pt18:Point3D = new Point3D(100, 100, 100);
			var pt19:Point3D = new Point3D(100, 200, 100);
			var pt20:Point3D = new Point3D(100, 200, 0);
			var pt21:Point3D = new Point3D(200, 100, 0);
			var pt22:Point3D = new Point3D(200, 100, 100);
			var pt23:Point3D = new Point3D(200, 200, 100);
			var pt24:Point3D = new Point3D(200, 200, 0);
			
			this.graphics.beginFill(0xCC0000, .5);
			var plane1:Plane3D = new Plane3D(pt1,pt2,pt3,pt4, this);
			this.graphics.endFill();

			this.graphics.beginFill(0x00CC00, .5);
			var plane2:Plane3D = new Plane3D(pt5,pt6,pt7,pt8, this);
			this.graphics.endFill();

			this.graphics.beginFill(0x0000CC, .5);
			var plane3:Plane3D = new Plane3D(pt9,pt10,pt11,pt12, this);
			this.graphics.endFill();
			
			this.graphics.beginFill(0xCCCC00, .5);
			var plane4:Plane3D = new Plane3D(pt13,pt14,pt15,pt16, this);
			this.graphics.endFill();						

			this.graphics.beginFill(0x00CCCC, .5);
			var plane5:Plane3D = new Plane3D(pt17,pt18,pt19,pt20, this);
			this.graphics.endFill();						
			
			this.graphics.beginFill(0xCCCCCC, .5);
			var plane6:Plane3D = new Plane3D(pt21,pt22,pt23,pt24, this);
			this.graphics.endFill();
			
		}
		
	}

}